<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/7/2 14:00
 * Modified Time: 2019/7/2 14:00
 * Version: 2.0
 */

namespace App\Modules\Inventory\Repositories;


use App\Models\GoodsCategory;
use App\Modules\Inventory\Validators\GoodsCategoryValidator;
use Flower\Core\Repository\Eloquent\BaseRepository;

class GoodsCategoryRepository extends BaseRepository
{
    public function model()
    {
        return GoodsCategory::class;
    }

    public function validator()
    {
        return GoodsCategoryValidator::class;
    }

    /**
     * 新增商品分类
     * @param $store_id
     * @param $parent_id
     * @param $name
     * @return mixed
     */
    public function createGoodsCategory($store_id,$parent_id,$name)
    {
        $data = [
            'store_id' => $store_id,
            'parent_id' => $parent_id,
            'name' => $name
        ];

        return $this->create($data);
    }

    /**
     * 编辑商品分类
     * @param $goods_category_id
     * @param $name
     * @return mixed
     */
    public function editGoodsCategory($goods_category_id,$name)
    {
        $data = [
            'name'=> $name
        ];
        return $this->update($data,$goods_category_id);
    }
}